<template>
  <div class="table-form">
    <div class="scroll">
      <div class="top">
        <div class="top-part">
          <div
            class="top-part-icon"
            :class="
              activeIndex === 0 ? 'icon1-sel' : 'icon1'
            "
          ></div>
          <div class="top-part-name">1.选择企业</div>
        </div>
        <div class="top-next"></div>
        <div class="top-part">
          <div
            class="top-part-icon"
            :class="
              activeIndex === 1 ? 'icon2-sel' : 'icon2'
            "
          ></div>
          <div class="top-part-name">2.智能推荐报告</div>
        </div>
        <div class="top-next"></div>
        <div class="top-part">
          <div
            class="top-part-icon"
            :class="
              activeIndex === 2 ? 'icon3-sel' : 'icon3'
            "
          ></div>
          <div class="top-part-name">3.查看报告详情</div>
        </div>
      </div>
      <div class="bottom">
        <vForm
          ref="formRef"
          @search="handleSearch"
          v-show="activeIndex === 0"
        />
        <vList
          ref="listRef"
          @detail="handleDetail"
          v-show="activeIndex === 1"
        />
        <detail
          ref="detailRef"
          v-show="activeIndex === 2"
        />
      </div>
    </div>
    <div class="line">
      <el-button
        @click="handleSearch"
        class="save-btn"
        v-if="activeIndex === 0"
        >智能筛选</el-button
      >
      <el-button
        @click="activeIndex = 0"
        class="save-btn"
        v-if="activeIndex === 1"
        >重新匹配</el-button
      >
      <el-button
        @click="activeIndex = 1"
        class="save-btn"
        v-if="activeIndex === 2"
        >返回上一级</el-button
      >
    </div>
  </div>
</template>

<script>
import {
  queryProjectList,
  deleteProjectInfo
} from '@/api/SelfBuiltSiteEnterprise'
import { getDictOptions } from '@/utils/dict'
import vForm from './components/form'
import vList from './components/list'
import detail from './components/detail'
import Icon from '@/components/icon'

export default {
  name: 'index',
  components: {
    Icon,
    vForm,
    vList,
    detail
  },
  data() {
    return {
      loading: false,
      activeIndex: 0
    }
  },
  mounted() {},
  methods: {
    async initOptions() {
      const data = await getDictOptions(
        'zhcy_qylx,zhcy_yjpy_fw,zhcy_sfss_zdxm'
      )
      this.companyTypeOptions = data.filter(
        (i) => i.dictCode === 'zhcy_qylx'
      )[0].resourceDictItems
      this.serviceTypeOptions = data.filter(
        (i) => i.dictCode === 'zhcy_yjpy_fw'
      )[0].resourceDictItems
      this.importantProjectOptions = data.filter(
        (i) => i.dictCode === 'zhcy_sfss_zdxm'
      )[0].resourceDictItems
    },
    handleSearch() {
      this.$refs.formRef.$refs.basicFormRef.validate(
        (res) => {
          if (res) {
            this.activeIndex = 1
            this.$refs.listRef.getStatistics(
              this.$refs.formRef.basicForm
            )
            this.$refs.listRef.getList(
              this.$refs.formRef.basicForm
            )
          }
        }
      )
    },
    handleDetail(pkid) {
      this.$refs.detailRef.getDetailInfo(pkid)
      this.activeIndex = 2
    }
  }
}
</script>

<style scoped lang="scss">
.table-form {
  width: 100%;
  height: 100%;
  overflow: hidden;
}
.top {
  width: 100%;
  height: 188px;
  background: url('~@/assets/img/zck/bg.png') no-repeat;
  background-size: 100% 100%;
  box-sizing: border-box;
  padding: 0 130px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  &-part {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    &-icon {
      width: 130px;
      height: 130px;
      margin-right: 25px;
    }
    &-name {
      font-size: 24px;
      font-family: PingFang SC;
      font-weight: bold;
      color: #5ea8df;
    }
    .icon1 {
      background: url('~@/assets/img/zck/qy.png') no-repeat;
      background-size: 100% 100%;
    }
    .icon1-sel {
      background: url('~@/assets/img/zck/qy-sel.png')
        no-repeat;
      background-size: 100% 100%;
    }
    .icon2 {
      background: url('~@/assets/img/zck/tj.png') no-repeat;
      background-size: 100% 100%;
    }
    .icon2-sel {
      background: url('~@/assets/img/zck/tj-sel.png')
        no-repeat;
      background-size: 100% 100%;
    }
    .icon3 {
      background: url('~@/assets/img/zck/xq.png') no-repeat;
      background-size: 100% 100%;
    }
    .icon3-sel {
      background: url('~@/assets/img/zck/xq-sel.png')
        no-repeat;
      background-size: 100% 100%;
    }
  }
  &-next {
    width: 35px;
    height: 29px;
    background: url('~@/assets/img/zck/next.png') no-repeat;
    background-size: 100% 100%;
  }
}
.bottom {
  width: 100%;
  height: calc(100% - 188px);
}
::-webkit-scrollbar {
  display: none;
}
.scroll {
  width: 100%;
  height: calc(100% - 83px);
  overflow-y: auto;
}
.line {
  width: 100%;
  box-sizing: border-box;
  padding: 13px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  .save-btn {
    background: #497fa3;
    border: 1px solid #497fa3;
    width: 222px;
    color: white;
    font-size: 14px;
    height: 57px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
}
</style>
